package com.ymm.service.impl;

import com.ymm.utils.security.SecurityUtils;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 椰咩咩咩
 * @version 1.0-SNAPSHOT
 * @date 2023/1/25 13:54
 * @Description 判断权限是否存在
 */
@Service("ps")
public class PermissionService {

    public boolean hasPermission(String perm) {
        if (SecurityUtils.isAdmin()) {
            return true;
        }
        List<String> permissions = SecurityUtils.getPermissions();
        return permissions.contains(perm);
    }

}
